6/22/2021

Plotly

Classic gapminder

Code in the next page

Code

gapminder%>%
    group_by(year,continent)%>%
    summarize(across(c(pop,lifeExp,gdpPercap),
                     ~sum(.x,na.rm=TRUE)),
              .groups = "drop")%>%
    plotly::plot_ly(x=~pop,y=~lifeExp,size=~gdpPercap,color=~continent,frame = ~year,
                    type="scatter",mode="markers")